/*

Author   : chaos

FileName : class_pre_dec.cpp

Date     : 13/08/17 20:13:21

*/
#include <iostream>
#include <cstring>
using namespace std;

class wife;

class husband
{
    private:
        char name [10];
    wife * my_wife;

    public:
    husband(const char * i_name) {strcpy(name,i_name);}
    const char * my_name()
    {
        return name;
    }
    void wife_is();
    void marry_me(wife &);
};

class wife
{
    private:
        char name[10];
        husband * my_husband;

    public:
        wife(const char * i_name)
        {
            strcpy(name,i_name);
        }
        void husband_is()
        {
            cout << "My husband is " << my_husband->my_name() << "." << endl;
        }

        void get_married(husband* a_husband)
        {
            my_husband = a_husband;
        }

        const char * my_name()
        {
            return name;
        }
};

void husband::wife_is()
{
    cout << "My wife is " << my_wife->my_name() << "." << endl;
}

void husband::marry_me(wife & a_wife)
{
    my_wife = &a_wife;
    my_wife->get_married(this);
}
int main(int argc ,char *argv[])
{
    husband Romeo("Romeo");
    wife Juliet("Juliet");

    Romeo.marry_me(Juliet);

    cout << " Juliet say :";
    Juliet.husband_is();

    cout << "Romeo yells happily :";
    Romeo.wife_is();
    return 0;
}
